package one.stand.service.impl;

import one.stand.enums.OrderStateEnum;
import one.stand.mapper.OrderinfoPublicMapper;
import one.stand.service.OrderInfoBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderInfoBaseServiceImpl implements OrderInfoBaseService {
    @Autowired
    private OrderinfoPublicMapper orderinfoPublicMapper;

    @Override
    public Integer countSales(Integer goodsId) {
        return orderinfoPublicMapper.selectSales(goodsId);
    }

    @Override
    public Integer countGroup(Integer groupId) {
        return orderinfoPublicMapper.selectGroupCount(groupId, null);
    }

    @Override
    public Integer countGroupWaitDeliver(Integer groupId) {
        return orderinfoPublicMapper.selectGroupCount(groupId, OrderStateEnum.WAIT_DELIVER.getCode());
    }
}
